package com.example.datajpatable.service;


import com.example.datajpatable.domain.Student;
import com.example.datajpatable.repository.StudentRepository;
import com.example.datajpatable.service.StudentService;
import org.aspectj.weaver.patterns.ExactTypePattern;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.*;
import org.springframework.stereotype.Service;
import sun.security.util.Password;

import java.util.List;

@Service
public interface StudentService {


    Page<Student> getUserList(int pageNum, int pageSize);


    List<Student> findAll();



    /**
     * 按id进行查询
     * @param id 主键，整数
     * @return
     */
    Student findById(Integer id);


    /**
     * 按名字进行查询
     * @param name
     * @return
     */
    List<Student> findBySname(String name);



//    List<Student> findBySnameAndSno(String name,String sno);

    Student insert(Student student);

    Student update(Student student);

    void delete(Integer id);

//    public void delete(Integer id){
//        studentRepository.deleteById(id);
//    }
//    public void delete(Student student){
//        studentRepository.delete(student);
//    }

    /**
     * 只支持分页的查询
     * @param pageable
     * @return
     */
    Page<Student> findAll(Pageable pageable);


//    List<Student> findAll(Example<Student> studentExample);

    Page<Student> findAll(Example<Student> student,Pageable pageable);

    public Student findBySnameAndSno(String name,String sno) throws Exception;
    public  List<Student> findBySnameAndPassword(String name,String password);
}